// generic mixins
@import (reference) "./mixins";
@import (reference) "./variables";
@import (reference) "~ui/styles/bootstrap/bootstrap";

html,
body {
  .flex-parent();
  height: 100%;
  margin: 0;
}

label > small {
  font-weight: normal;
}

button {
  // buttons have a stupid 1990's default look which should be disabled
  .btn();
}

.small {
  font-size: 0.9em !important;
}
.smaller {
  font-size: 0.8em !important;
}
.smallest {
  font-size: 0.7em !important;
}

// Colors available for font awesome icons, these might not look good with normal text
.text-color-primary {
  color: @brand-primary;
}

.text-color-info {
  color: @brand-info;
}

.text-color-success {
  color: @brand-success;
}

.text-color-warning {
  color: @brand-warning;
}

.text-color-danger {
  color: @brand-danger;
}

.text-monospace {
  font-family: @font-family-monospace;
}

code {
  word-break: break-all;
  word-wrap: break-word;
}

ul.navbar-inline li {
  display: inline;
}

.tooltip {
  font-size: 8pt;
  font-weight: normal;
  opacity: 90%;
}

  .tooltip-inner {
    word-break: normal;
    word-wrap: break-word;
    white-space: normal;
  }

.content {
  .real-flex-parent(@flow: row nowrap);
  width: 100%;
  height: 100%;
  overflow: hidden;

  > nav {
    z-index: 1;

    .navbar-right {
      margin-right: 0 !important;
    }
  }
}

.application {
  .flex-parent(@shrink: 0);
  position: relative;
  z-index: 0;
  background-color: @white;
}

.top-fixed {
  position: fixed;
  bottom: 0px;
}

.checkbox label {
  display: flex;
  align-items: center;
  padding-left: 0;

  input[type="checkbox"] {
    float: none;
    margin: 0 4px;
    position: static;
  }
}

notifications {
  z-index: 1;
}

//== Subnav
//
// Use for adding a subnav to your app
.navbar {
  margin-bottom: 0px!important;
}

a {
  // overriden by next rule for a tags that actually have an href
  cursor: default;
}

.link, [ng-click], [clip-copy], [href], [confirm-click] {
  cursor: pointer;
}

.application,
.app-container {
  > * {
    position: relative;
    z-index: 0;
  }

  .kibana-nav-options {
    padding-bottom: 0;
    padding-right: 0px;

    kbn-global-timepicker {
      line-height: 20px;
    }

    .kibana-nav-actions {
      margin-left: auto;
      padding-right: 0;
      line-height: 20px;

      .button-group > :last-child {
        border-radius: 0;
      }
    }
  }

  > config {
    z-index: 1;
  }
  > navbar { padding-bottom: 4px; }
  > kbn-top-nav { z-index: 3; }

  > nav,
  > navbar {
    z-index: 2 !important;
  }
}

//== Nav tweaks
.nav-condensed > li > a {
  padding-top: 2px;
  padding-bottom: 2px;
}

.navbar > .container-fluid {
  > .navbar-nav,
  > .navbar-form {
    &:not(.pull-right):first-child {
      // This is how .navbar-brand accomplishes it's solid placement
      margin-left: -15px;
      margin-top: 4px;
    }
  }
}

.navbtn {
  .button-variant(@navbar-default-color; @navbar-default-bg; @navbar-default-border);
}

.navbtn-inverse {
  .button-variant(@navbar-default-color; @navbar-default-bg; @navbar-default-border);
}

  .navbar-timepicker-time-desc > .fa-clock-o {
    padding-right: 5px;
  }

kbn-info i {
  cursor: help;
}

.kbn-timepicker .btn-default {
  background: transparent;
  color: @text-color;
  border: 0px;
  box-shadow: none;
  text-shadow: none;
}

.kbn-timepicker .btn-info {
  .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);
  .text-info { color: @btn-info-color; }
  text-shadow: none;
}

.kbn-timepicker .refresh-interval {
  padding: 0.2em 0.4em;
  border-radius: @border-radius-small;
}

.kbn-timepicker .refresh-interval-active {
  background-color: @btn-info-bg;
  color: @btn-info-color;
}

//== Table

kbn-table, .kbn-table {
  font-size: @font-size-small;

  th {
    white-space: nowrap;
    padding-right: 10px;

    .table-header-move, .table-header-sortchange {
      visibility: hidden;
    }

    .fa {
      font-size: 1.1em;
    }

  }

  th:hover {
    .table-header-move, .table-header-sortchange {
      visibility: visible;
    }
  }
}

//== Generic Table
table {
  td .fa {
    // font-awesome's override of the line-height usually doesn't
    // cauase problems, but in the table it pushes the icon to the
    // top of the row
    line-height: @line-height-base;
  }
}

//== SavedObjectFinder
saved-object-finder,
paginated-selectable-list {
  .row {
    padding: 10px;
    display: flex;
    flex-direction: row;
  }

  .finder-hit-count,
  .finder-manage-object {
    min-width: 80px;
    padding: 5px;
    text-align: center;
  }

  .finder-hit-count {
    flex: 1;

    span {
      color: @kibanaGray3;
    }
  }

  .finder-manage-object {
    flex: 3;
    text-align: left;
    text-transform: capitalize;
  }

  .form-group {
    margin-bottom: 0;
    float: left;
    flex: 8;

    input {
      border: none;
      padding: 5px 0px;
      border-radius: @border-radius-base;
    }

    span {
      padding: 5px 0px;
      background-color: @white;
      border: none;

      i {
        color: @kibanaGray3;
        width: 15px;
      }
    }
  }

  ul.li-striped {
    li {
      border: none;
    }

    li:nth-child(odd) {
      background-color: @kibanaGray6;
    }

    li:nth-child(even) {
      background-color: @white;
    }

    .paginate-heading {
      font-weight: normal;
      color: @kibanaGray1;
    }

    .list-group-item {
      padding: 8px 15px;

      ul {
        padding: 0;
        display: flex;
        flex-direction: row;

        .finder-type {
          margin-right: 10px;
        }
      }

      a {
        i {
          color: @saved-object-finder-icon-color !important;
          margin-right: 10px;
        }

        display: block;
        color: @saved-object-finder-link-color !important;
      }

      &:first-child {
        .border-top-radius(0) !important;
      }

      &.list-group-no-results p {
        margin-bottom: 0 !important;
      }
    }
  }

  .finder-form {
    position: relative;
  }

    .finder-form-options {
      .flex-parent();
      flex-direction: row;
      justify-content: flex-end;
    }

  .finder-options {
    max-height: 300px;
    overflow: auto;
    padding: 0;
    .border-top-radius(0);

    // replace the padding that was originally on the outer well
    > * {
      padding: @padding-base-vertical @padding-base-horizontal;
      margin: 0;
    }

    // enable bigger backgrounds for "active" elements
    > li {
      margin-top: -ceil(@padding-base-vertical / 2);

      &:first-child {
        margin: 0;
      }
      &.active {
        background-color: @component-active-bg;
        color: @component-active-color;
        a {
          color: @component-active-color;
        }
      }
    }
  }

  paginate {
    paginate-controls {
      margin: 20px;
    }
  }
}

// when rendered within a config dropdown, don't use a bottom margin
.config saved-object-finder .finder-options {
  margin-bottom: 0;
  background: @config-saved-object-finder-options-bg;
}

//== inputDatetime
.input-datetime-format {
  font-size: @font-size-small;
  color: @text-muted;
  padding: @padding-base-vertical @padding-base-horizontal;
}

//== clicking disabled buttons should not cause the whole page to get selected
button[disabled] {
  user-select: none;
}

//== override the disabled cursor that doesn't work everywhere
.form-control{
  &[disabled],
  &[readonly],
  fieldset[disabled] & {
    cursor: default;
    opacity: .8;
  }
}

.fatal-body {
  white-space: pre-wrap;
}

.ng-dirty, .ng-touched {
  input.ng-invalid&,
  textarea.ng-invalid&,
  select.ng-invalid& {
    border-color: @state-danger-bg !important;
  }
}

input[type="radio"],
input[type="checkbox"],
.radio,
.radio-inline,
.checkbox,
.checkbox-inline {
  &[disabled],
  fieldset[disabled] & {
    cursor: default;
    opacity: .8;
  }
}

textarea {
  resize: vertical;
}

.field-collapse-toggle {
  color: @field-collapse-toggle-color;
  margin-left: 10px !important;
}

style-compile {
  display: none;
}

.tooltip-inner {
  white-space: pre-wrap !important;
}

@import '../filter_bar/filter_bar.less';


.cell-hover {
  background-color: @table-cell-hover-bg;
  position: relative;

  .table-cell-filter {
    position: absolute;
    background-color: @table-cell-hover-bg;
    white-space: nowrap;
    right: 0;
    top: 5px;
    display: none;
  }
}

  .cell-hover-show {
    // so that the cell doesn't change size on hover
    visibility: hidden;
  }

.cell-hover:hover {
  .table-cell-filter {
    display: inline;
  }

  .cell-hover-show {
    visibility: visible;
  }
}

mark, .mark {
  background-color: @mark-bg;
}

fieldset {
  margin: @form-group-margin-bottom;
  padding: @form-group-margin-bottom;
  border: 1px solid @input-border;
  border-radius: @input-border-radius-base;
}

[fixed-scroll] {
  overflow-x: auto;
  padding-bottom: 0px;

  + .fixed-scroll-scroller {
    position: fixed;
    bottom: 0px;
    overflow-x: auto;
    overflow-y: hidden;
  }
}

.list-group {
  .list-group-item {
    &.active,
    &.active:hover,
    &.active:focus {
      background-color: @list-group-menu-item-active-bg;
      cursor: default;
    }
  }
}

// TODO: Extract these styles into the UI Framework.

.page-row {
  padding: 0 10px;
  margin: 10px 0;
}

.page-row-text {
  color: @kibanaGray2;
  font-size: 14px;
}

.kuiFormSection {
  margin-bottom: 16px;
}

.kuiFormSubSection {
  margin-bottom: 8px;
}

.kuiFormLabel {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
}

.kuiFormSubLabel {
  display: block;
  font-weight: normal;
}

  .kuiFormSubLabel__note {
    opacity: 0.5;
    margin-left: 4px;
    font-size: 12px;
  }

.kuiInputNote {
  margin: 5px 0 10px;
}

.kuiInputNote--danger {
  color: #E74C3C;
}

.kuiInputNote--warning {
  color: #F39C12;
}

/**
 * 1. Override Bootstrap ui-select component styles. If side padding is > 5px, the component breaks.
 */
.ui-select-multiple.ui-select-bootstrap {
  padding: 3px 5px 2px !important; // 1
  border: 1px solid #D4D4D4; // 1
  background-color: #ffffff !important; // 1

  &.kuiInputError {
    border-color: #E74C3C; // 1
  }
}

/**
 * 1. Override label styles.
 */
.kuiOptionLabel {
  font-weight: normal; // 1
  cursor: pointer;
}

.kuiFormPanel {
  border: 1px solid #D4D4D4;
  padding: 12px;
}

.kuiList {
  margin-bottom: 10px;
}

.kuiListItem {
  padding: 12px 0;

  & + & {
    border-top: 2px dashed rgba(212, 212, 212, 0.5);
  }

  &:first-child {
    padding-top: 0;
  }

  &:last-child {
    padding-bottom: 0;
  }
}

/**
 * Utility class.
 */
.fullWidth {
  width: 100% !important;
}

/**
 * Utility class.
 */
.noPadding {
  padding: 0 !important;
}

/**
 * TODO: This is a generic pattern that should be replaced by specific components, e.g. inputGroup.
 */
.flexGroup {
  display: flex;
  width: 100%;
}

  .flexGroup__filler {
    flex: 1 1 auto;
  }

.kuiFormSection {
  margin-bottom: 16px;
}

.kuiFormLabel {
  display: block;
}

.kuiFormSubLabel {
  display: block;
  font-weight: normal;
}

.kuiSideBarSelect {
  // TODO: @include kuiSelect styles when this is moved to the UI Framework and we're using SASS.
  height: 24px;
  width: 100%;
  font-size: 12px;
  padding: 0 15px;
}

.kuiSideBarInput {
  // TODO: @include kuiInput styles when this is moved to the UI Framework and we're using SASS.
  display: block;
  width: 100%;
  height: 24px;
  font-size: 12px;
  color: #2d2d2d;
  border: 1px solid #D4D4D4;
  border-radius: 4px;
  padding: 5px 15px;
}

.kuiSideBarSection {
  margin-bottom: 6px;
}

.kuiSideBarSection__main {
  margin-bottom: 25px;
}

.kuiSideBarSectionTitle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  border-bottom: 1px solid #D4D4D4;
}

.kuiSideBarSection__main .kuiSideBarSectionTitle {
  background-color: #E4E4E4;
  padding: 2px 10px;
}

.kuiSideBarSectionTitle__text {
  font-size: 14px;
  font-weight: 700;
  color: #5A5A5A;
}

/**
 * 1. Override Bootstrap button styles.
 */
.kuiSideBarSectionTitle__action {
  background-color: transparent; // 1
  padding: 0; // 1
  cursor: pointer;
  color: #328CAA;

  &:hover {
    color: #105A73;
  }
}

.kuiSideBarCollapsibleTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 4px;
  border-bottom: 1px solid #E8E8E8;
}

.kuiSideBarCollapsibleTitle__label {
  display: flex;
  align-items: center;
}

/**
 * 1. Override FontAwesome .fa styles.
 */
.kuiSideBarCollapsibleTitle__caret {
  width: 12px;
  height: 12px;
  font-size: 12px !important; // 1
  font-weight: 700;
  color: #5A5A5A;
}

.kuiSideBarCollapsibleTitle__text {
  font-size: 12px;
  font-weight: 700;
  color: #5A5A5A;
}

/**
 * 1. Override Bootstrap button styles.
 */
.kuiSideBarCollapsibleTitle__action {
  background-color: transparent; // 1
  padding: 0; // 1
  cursor: pointer;
  color: #328CAA;

  &:hover {
    color: #105A73;
  }
}

.kuiSideBarCollapsibleSection {
  padding-left: 16px;
}

/**
 * 1. Override Bootstrap h1 styles.
 */
.kuiSideBarFormSectionTitle {
  font-size: 12px;
  font-weight: 700;
  color: #5A5A5A;
  border-bottom: 1px solid #E8E8E8;
  margin: 4px 0 !important; // 1
  padding-bottom: 2px;
}

.kuiSideBarFormRow {
  display: flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 1px;
}

/**
 * 1. Override .vis-editor-sidebar styles.
 */
.kuiSideBarFormRow__label {
  display: flex;
  align-items: center;
  flex: 1 1 40% !important; // 1
  font-weight: 400;
}

.kuiSideBarFormRow__label__colorbox {
  width: 24px;
  height: 24px;
  display: inline-block;
  margin-right: 10px;
  border: 1px ridge lightgray;
}

.kuiSideBarFormRow__control {
  display: flex;
  align-items: center;
  flex: 1 1 60%;
}

/**
 * 1. Override .sidebar-item styles.
 */
.kuiSideBarOptionsLink {
  display: flex;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 12px;
  color: #328CAA !important; // 1

  &:hover {
    color: #105A73 !important; // 1
  }
}

.kuiSideBarOptionsLink__caret {
  width: 10px;
  height: 10px;
}

.kuiSideBarOptionsLink__text {
  margin-left: 2px;
}

@import "~dragula/dist/dragula.css";
